docker import

1 Docker import 本地文件

1.1 概述。

导出的文件又可以使用docker import命令导入变成镜像

1.2 语法大纲

$ docker import --help
Usage:  docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Import the contents from a tarball to create a filesystem image
Options:
  -c, --change list       Apply Dockerfile instruction to the created image
  -m, --message string    Set commit message for imported image
      --platform string   Set platform if server is multi-platform capa

1.3 参数说明

参数 说明
-c, --change list 通过Dockerfile来创建镜像 。
-m, --message string 提交注释信息。
--platform string 设置平台兼容性。

1.4 导入容器

编者注:注意导入 tar 包后,产生的不是一个容器而是一个镜像。

$ docker import kcp_centos.tar kcp_centos:v1.2
$ docker images

2 Docker import 命令

OPENVZ 模板的下载地址
http://openvz.org/Download/templates/precreated

2.1 命令语法

Usage:  docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]

2.2 命令说明

选项 说明
import 导入模板。
OPTIONS 参数选项。
file\URL- 本地文件\网页下载地址\标准输入
REPOSITORY 仓库名称。
TAG 标签名称。

2.3 【Options】选项

(1)参数查看。

$ docker import --help 
Usage:  docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]

Import the contents from a tarball to create a filesystem image

Options:
  -c, --change list       Apply Dockerfile instruction to the created image
  -m, --message string    Set commit message for imported image
      --platform string   Set platform if server is multi-platform capable

(2)参数说明。

参数 说明
-c, --change list 基于模板文件,自定义应用 Dockerfile 指令。
-m,--message="" 提交镜像相关的注释。
--platform string 如果服务器有跨平台功能,则启用。